﻿<Window x:Class="ColoredText.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <TextBlock Text="{Binding ElementName=BoundText, Path=Text}" 
                   Foreground="{Binding ElementName=ForegroundColor, Path=SelectedItem.Content, Mode=OneWay}"
                   Background="{Binding ElementName=BackgroundColor, Path=SelectedItem.Content, Mode=OneWay}"/>
        <TextBox x:Name="BoundText"/>
        <ListBox x:Name="ForegroundColor" Width="248" Height="52">
            <ListBoxItem Content="Blue"/>
            <ListBoxItem Content="Green"/>
            <ListBoxItem Content="Yellow"/>
            <ListBoxItem Content="Red"/>
            <ListBoxItem Content="Purple"/>
            <ListBoxItem Content="Orange"/>
        </ListBox>
        <ListBox x:Name="BackgroundColor" Width="248" Height="52">
            <ListBoxItem Content="Blue"/>
            <ListBoxItem Content="Green"/>
            <ListBoxItem Content="Yellow"/>
            <ListBoxItem Content="Red"/>
            <ListBoxItem Content="Purple"/>
            <ListBoxItem Content="Orange"/>
        </ListBox>
    </StackPanel>
</Window>
